import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../config/config.dart';
import '../../views/common_widget.dart';
import 'logic.dart';

class SettingPage extends StatelessWidget {
  SettingPage({super.key});

  final logic = Get.find<SettingLogic>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Config.colorBg,
      resizeToAvoidBottomInset: false,
      body: Column(
        children: [
          CommonWidget.commonAppBar("设置"),
          //菜单
          Container(
            width: double.infinity,
            margin: EdgeInsets.only(top: 30.w,left: 35.w,right: 35.w),
            padding: EdgeInsets.symmetric(horizontal: 35.w, vertical: 4.w),
            decoration: BoxDecoration(
              color: Config.colorBg2,
              borderRadius: BorderRadius.circular(Config.roundBig.w),
            ),
            child: ListView(
              padding: const EdgeInsets.symmetric(vertical: 0),
              scrollDirection: Axis.vertical,
              shrinkWrap: true,
              children: [
                menuItem("修改手机号码", Icons.phone_android_rounded, () {}),
                CommonWidget.commonDivider(),
                menuItem("修改登录密码", Icons.health_and_safety_outlined, () {}),
                CommonWidget.commonDivider(),
                menuItem("切换语言", Icons.language_rounded, () {}),
              ],
            ),
          ),
          Expanded(child: Container(
            width: Get.width,
            alignment: Alignment.bottomCenter,
            padding: EdgeInsets.only(bottom: 120.w),
            child: CommonWidget.commonButton("退出登录", () {
            }, radius: 60.w, width: 580.w,bgColor: Config.colorBg2,sideColor: Config.colorText3.withOpacity(0.3)),
          ),),
        ],
      ),
    );
  }

  menuItem(String title, IconData icon, Function() onTap) {
    return InkWell(
      onTap: onTap,
      child: SizedBox(
        height: 114.w,
        child: Row(
          children: [
            Icon(
              icon,
              size: 50.w,
              color: Config.colorText1,
            ),
            SizedBox(width: 20.w),
            Text(
              title,
              style: TextStyle(color: Config.colorText1, fontSize: Config.textSizeSubTitle.sp),
            ),
            Expanded(
                child: Container(
              alignment: Alignment.centerRight,
              child: Icon(
                Icons.arrow_forward_ios_rounded,
                color: Config.colorText3.withOpacity(0.7),
                size: 32.w,
              ),
            ))
          ],
        ),
      ),
    );
  }
}
